﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageRoadItem.aspx.cs" Inherits="WebForm_ManageRoad_ManageRoadItem" %>
<%@ Register assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" tagprefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Namespace="My" TagPrefix="cc2" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <Base target="_self"/>
</head>
<body>
    <form id="form1" runat="server" >
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
<asp:Panel id="Panel3" runat="server" GroupingText="詳細路名設定"><TABLE width="100%"><TBODY><TR><TD><asp:FormView id="fv" runat="server" OnDataBound="fv_DataBound" Width="98%" DefaultMode="Insert" DataSourceID="SqlDataSource2" DataKeyNames="id"><InsertItemTemplate>
<TABLE cellSpacing=0 cellPadding=0 border=0><TBODY><TR><TD colSpan=2>
    <asp:Label ID="Label1" runat="server" Text="道路總稱："></asp:Label><asp:Label ID="lblRoadName"
        runat="server"></asp:Label><br />
    <cc1:ConfirmButtonExtender id="ConfirmButtonExtender1" runat="server" TargetControlID="InsertButton" ConfirmText="確定要新增?">
                            </cc1:ConfirmButtonExtender> <asp:Label id="lblRegionName" runat="server" Text="路名："></asp:Label><asp:TextBox id="txtRoadName" runat="server" Width="350px" MaxLength="100" Text='<%# Bind("RoadItemName") %>'></asp:TextBox> <asp:LinkButton id="InsertButton" runat="server" ValidationGroup="vInsert" Text="新增" CommandName="Insert" CausesValidation="True"></asp:LinkButton> <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ValidationGroup="vInsert" SetFocusOnError="True" InitialValue="0" ErrorMessage="請輸入路名!!" Display="None" ControlToValidate="txtRoadName"></asp:RequiredFieldValidator></TD></TR></TBODY></TABLE>
</InsertItemTemplate>
</asp:FormView><asp:SqlDataSource id="SqlDataSource2" runat="server" UpdateCommand="UPDATE [FD_RoadItem] SET [RoadItemName] = @RoadItemName WHERE [RoadItemID] = @RoadItemID" SelectCommand="SELECT * FROM [FD_RoadItem] WHERE ([RoadID] = @RoadID) ORDER BY [RoadItemName]" DeleteCommand="DELETE FROM [FD_RoadItem] WHERE [RoadItemID] = @RoadItemID" InsertCommand="INSERT INTO [FD_RoadItem] ([RoadID], [RoadItemName]) VALUES (@RoadID, @RoadItemName)" ConnectionString="<%$ ConnectionStrings:connStr %>"><SelectParameters>
<asp:Parameter Name="RoadID" Type="String"></asp:Parameter>
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="RoadItemID" Type="Int32"></asp:Parameter>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="RoadItemName" Type="String"></asp:Parameter>
<asp:Parameter Name="RoadItemID" Type="Int32"></asp:Parameter>
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="RoadID" Type="String"></asp:Parameter>
<asp:Parameter Name="RoadItemName" Type="String"></asp:Parameter>
</InsertParameters>
</asp:SqlDataSource> <My:MyGridView id="gv" runat="server" Width="99%" DataSourceID="SqlDataSource2" DataKeyNames="RoadID,RoadItemID" OnRowDataBound="gv_RowDataBound" ShowFooterWhenEmpty="False" ForeColor="#333333" GridLines="Horizontal" CellPadding="3" BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF" BackColor="White" MouseOverColor AutoGenerateColumns="False" MySortDirection="Ascending" AllowHoverEffect="False" AllowHoverSelect="False" SkinID="pager" TotalRowCount="0">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></FooterStyle>

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></HeaderStyle>

<EditRowStyle BackColor="#999999"></EditRowStyle>

<PagerStyle HorizontalAlign="Center" BackColor="#284775" ForeColor="White"></PagerStyle>

<EmptyDataRowStyle HorizontalAlign="Center"></EmptyDataRowStyle>

<AlternatingRowStyle BackColor="White" ForeColor="#284775"></AlternatingRowStyle>
<Columns>
<asp:TemplateField HeaderText="NO" InsertVisible="False"><EditItemTemplate>
<asp:Label id="lblNO" runat="server" __designer:wfdid="w29"></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label id="lblNO" runat="server" __designer:wfdid="w71"></asp:Label> 
</ItemTemplate>

<HeaderStyle Width="20px"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="路名" SortExpression="RoadItemName"><EditItemTemplate>
<asp:TextBox id="TextBox2" runat="server" Width="350px" Text='<%# Bind("RoadItemName") %>' MaxLength="100" __designer:wfdid="w32"></asp:TextBox><asp:RequiredFieldValidator id="RequiredFieldValidator11" runat="server" ValidationGroup="vEdit" SetFocusOnError="True" InitialValue="0" ErrorMessage="請輸入路名!!" Display="None" ControlToValidate="TextBox2" __designer:wfdid="w73"></asp:RequiredFieldValidator> 
</EditItemTemplate>
<ItemTemplate>
<asp:Label id="Label3" runat="server" Text='<%# Eval("RoadItemName") %>' __designer:wfdid="w23"></asp:Label> 
</ItemTemplate>

<HeaderStyle Width="120px"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False"><EditItemTemplate>
<asp:LinkButton id="LinkButton1" runat="server" ValidationGroup="vEdit" Text="更新" CommandName="Update" CausesValidation="True" __designer:wfdid="w30"></asp:LinkButton>&nbsp;<asp:LinkButton id="LinkButton2" runat="server" Text="取消" CommandName="Cancel" CausesValidation="False" __designer:wfdid="w31"></asp:LinkButton> 
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton id="LinkButton1" runat="server" Text="編輯" CommandName="Edit" CausesValidation="False" __designer:wfdid="w24"></asp:LinkButton>&nbsp; <asp:LinkButton id="deletebutton" runat="server" Text="刪除" CommandName="Delete" CausesValidation="False" __designer:wfdid="w25"></asp:LinkButton><cc1:ConfirmButtonExtender id="ConfirmButtonExtender2" runat="server" TargetControlID="deletebutton" ConfirmText="確定要刪除?(相關案件將無法再對應!!)" __designer:wfdid="w26"></cc1:ConfirmButtonExtender> 
</ItemTemplate>

<HeaderStyle Width="70px"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>

<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"></SelectedRowStyle>

<RowStyle BackColor="#F7F6F3" ForeColor="#333333"></RowStyle>
</My:MyGridView> </TD></TR></TBODY></TABLE><asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" 
            ShowMessageBox="True" ShowSummary="False" ValidationGroup="vInsert" />
    <asp:ValidationSummary ID="ValidationSummary2" runat="server" DisplayMode="List" 
            ShowMessageBox="True" ShowSummary="False" ValidationGroup="vEdit" />
</asp:Panel> 
                <br />
<asp:Panel id="Panel1" runat="server" GroupingText="隸屬公所">
<TABLE width="100%">
    <TBODY>
        <TR>
            <TD>
                <asp:FormView id="fvRole1" runat="server" OnDataBound="fv_DataBound" Width="98%" DefaultMode="Insert" DataSourceID="dsRole1" DataKeyNames="id" OnItemInserting="fvRole1_ItemInserting">
                    <InsertItemTemplate>
                        <TABLE cellSpacing=0 cellPadding=0 border=0>
                            <TBODY>
                                <TR>
                                    <TD colSpan=2>
                                        <asp:Label ID="Label1" runat="server" Text="單位名稱："></asp:Label>
                                        <asp:DropDownList ID="ddlOrganizationName" runat="server" DataSourceID="SqlDataSource1" DataTextField="OrganizationName" DataValueField="OrganizationID">
                                        </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
                                            SelectCommand="SELECT [OrganizationName], [OrganizationID] FROM [Organization] WHERE (([OrganizationName] NOT LIKE '%' + @OrganizationName + '%') AND ([OrganizationName] NOT LIKE '%' + @OrganizationName2 + '%') AND ([OrganizationName] NOT LIKE '%' + @OrganizationName3 + '%')) ORDER BY Sequence,[OrganizationName]">
                                            <SelectParameters>
                                                <asp:Parameter DefaultValue="%公路%" Name="OrganizationName" Type="String" />
                                                <asp:Parameter DefaultValue="%工務段%" Name="OrganizationName2" Type="String" />
                                                <asp:Parameter DefaultValue="%工程處%" Name="OrganizationName3" Type="String" />
                                            </SelectParameters>
                                        </asp:SqlDataSource>
                                        <cc1:ConfirmButtonExtender id="ConfirmButtonExtender1" runat="server" TargetControlID="InsertButton" ConfirmText="確定要新增?">
                                        </cc1:ConfirmButtonExtender>
                                        &nbsp;<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                                            Text="新增" ValidationGroup="vRole1Insert"></asp:LinkButton>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlOrganizationName"
                                            Display="None" ErrorMessage="請選擇單位名稱!!" InitialValue="0" SetFocusOnError="True"
                                            ValidationGroup="vRole1Insert"></asp:RequiredFieldValidator></td>
                                </tr>
                            </tbody>
                        </table>
                    </InsertItemTemplate>
                </asp:FormView>
                <asp:SqlDataSource id="dsRole1" runat="server" SelectCommand="SELECT a.*,b.OrganizationName FROM [FD_OrganizationRoadMapping] a join Organization b on a.OrganizationID=b.OrganizationID WHERE (([RoadID] = @RoadID) AND ([Manage_Type] = @Manage_Type)) ORDER BY b.Sequence,[RoadID]" UpdateCommand="update [FD_OrganizationRoadMapping] set OrganizationID=@New_OrganizationID WHERE [RoadID] = @RoadID AND [OrganizationID] = @OrganizationID AND [Manage_Type] = @Manage_Type" DeleteCommand="DELETE FROM [FD_OrganizationRoadMapping] WHERE [RoadID] = @RoadID AND [OrganizationID] = @OrganizationID AND [Manage_Type] = @Manage_Type" InsertCommand="INSERT INTO [FD_OrganizationRoadMapping] ([RoadID],[OrganizationID], [Manage_Type]) VALUES (@RoadID,@OrganizationID, @Manage_Type)" ConnectionString="<%$ ConnectionStrings:connStr %>">
                    <SelectParameters>
                        <asp:Parameter Name="RoadID" Type="String" />
                        <asp:Parameter DefaultValue="1" Name="Manage_Type" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="RoadID" Type="String" />
                        <asp:Parameter Name="OrganizationID" Type="Int32" />
                        <asp:Parameter DefaultValue="1" Name="Manage_Type" Type="String" />
                        <asp:Parameter Name="New_OrganizationID" Type="Int32" />
                    </UpdateParameters>
                    <DeleteParameters>
                        <asp:Parameter Name="RoadID" Type="String" />
                        <asp:Parameter Name="OrganizationID" Type="Int32" />
                        <asp:Parameter DefaultValue="1" Name="Manage_Type" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="RoadID" Type="String" />
                        <asp:Parameter Name="OrganizationID" Type="Int32" />
                        <asp:Parameter DefaultValue="1" Name="Manage_Type" Type="String" />
                    </InsertParameters>
                </asp:SqlDataSource>
                <My:MyGridView id="gvRole1" runat="server" Width="99%" DataSourceID="dsRole1" DataKeyNames="RoadID,OrganizationID,Manage_Type" OnRowDataBound="gvRole1_RowDataBound" ShowFooterWhenEmpty="False" ForeColor="#333333" GridLines="Horizontal" CellPadding="3" BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF" BackColor="White" MouseOverColor AutoGenerateColumns="False" MySortDirection="Ascending" AllowHoverEffect="False" AllowHoverSelect="False" SkinID="pager" TotalRowCount="0" OnRowUpdating="gvRole1_RowUpdating">
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#999999" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <EmptyDataRowStyle HorizontalAlign="Center" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:TemplateField HeaderText="NO" InsertVisible="False">
                            <edititemtemplate>
<asp:Label id="lblNO" runat="server"></asp:Label>
</edititemtemplate>
                            <itemtemplate>
<asp:Label id="lblNO" runat="server" __designer:wfdid="w37"></asp:Label> 
</itemtemplate>
                            <headerstyle width="20px" />
                            <itemstyle horizontalalign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="單位名稱" SortExpression="OrganizationName">
                            <edititemtemplate>
<asp:DropDownList id="ddlOrganizationName" runat="server" DataSourceID="SqlDataSource1" __designer:wfdid="w38" DataValueField="OrganizationID" DataTextField="OrganizationName"></asp:DropDownList> <asp:HiddenField id="hideOrganizationID" runat="server" __designer:wfdid="w39" Value='<%# Bind("OrganizationID") %>'></asp:HiddenField> <asp:SqlDataSource id="SqlDataSource1" __designer:dtid="281479271678021" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>" SelectCommand="SELECT [OrganizationName], [OrganizationID] FROM [Organization] WHERE (([OrganizationName] NOT LIKE '%' + @OrganizationName + '%') AND ([OrganizationName] NOT LIKE '%' + @OrganizationName2 + '%') AND ([OrganizationName] NOT LIKE '%' + @OrganizationName3 + '%')) ORDER BY Sequence,[OrganizationName]" __designer:wfdid="w43">
                                            <SelectParameters __designer:dtid="281479271678022">
                                                <asp:Parameter __designer:dtid="281479271678023" DefaultValue="%公路%" Name="OrganizationName" Type="String"  />
                                                <asp:Parameter __designer:dtid="281479271678024" DefaultValue="%工務段%" Name="OrganizationName2" Type="String"  />
                                                <asp:Parameter __designer:dtid="281479271678025" DefaultValue="%工程處%" Name="OrganizationName3" Type="String"  />
                                            </SelectParameters>
                                        </asp:SqlDataSource> <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ValidationGroup="vRole1Edit" SetFocusOnError="True" InitialValue="0" ErrorMessage="請選擇單位名稱!!" Display="None" ControlToValidate="ddlOrganizationName" __designer:wfdid="w41"></asp:RequiredFieldValidator> 
</edititemtemplate>
                            <itemtemplate>
<asp:Label id="Label3" runat="server" Text='<%# Bind("OrganizationName") %>'></asp:Label> 
</itemtemplate>
                            <headerstyle width="120px" />
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False">
                            <edititemtemplate>
<asp:LinkButton id="LinkButton1" runat="server" ValidationGroup="vRole1Edit" Text="更新" CommandName="Update" CausesValidation="True" __designer:wfdid="w29"></asp:LinkButton>&nbsp;<asp:LinkButton id="LinkButton2" runat="server" Text="取消" CommandName="Cancel" CausesValidation="False" __designer:wfdid="w30"></asp:LinkButton> 
</edititemtemplate>
                            <itemtemplate>
<asp:LinkButton id="LinkButton1" runat="server" Text="編輯" CommandName="Edit" CausesValidation="False"></asp:LinkButton>&nbsp; <asp:LinkButton id="deletebutton" runat="server" Text="刪除" CommandName="Delete" CausesValidation="False"></asp:LinkButton><cc1:ConfirmButtonExtender id="ConfirmButtonExtender3" runat="server" TargetControlID="deletebutton" ConfirmText="確定要刪除?(相關案件將無法再對應!!)"></cc1:ConfirmButtonExtender> 
</itemtemplate>
                            <headerstyle width="70px" />
                            <itemstyle horizontalalign="Center" />
                        </asp:TemplateField>
                    </Columns>
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                </My:MyGridView><asp:ValidationSummary ID="ValidationSummary3" runat="server" DisplayMode="List" 
            ShowMessageBox="True" ShowSummary="False" ValidationGroup="vRole1Insert" />
                <asp:ValidationSummary ID="ValidationSummary4" runat="server" DisplayMode="List" 
            ShowMessageBox="True" ShowSummary="False" ValidationGroup="vRole1Edit" />
            </td>
        </tr>
    </tbody>
</table>
</asp:Panel>
                <br />
                <asp:Panel id="Panel2" runat="server" GroupingText="隸屬工務段">
                    <TABLE width="100%">
                        <TBODY>
                            <TR>
                                <TD>
                                    <asp:FormView id="fvRole2" runat="server" OnDataBound="fv_DataBound" Width="98%" DefaultMode="Insert" DataSourceID="dsRole2" DataKeyNames="id" OnItemInserting="fvRole2_ItemInserting">
                                        <InsertItemTemplate>
                                            <TABLE cellSpacing=0 cellPadding=0 border=0>
                                                <TBODY>
                                                    <TR>
                                                        <TD colSpan=2>
                                                            <asp:Label ID="Label1" runat="server" Text="單位名稱："></asp:Label>
                                                            <asp:DropDownList ID="ddlOrganizationName" runat="server" DataSourceID="SqlDataSource1" DataTextField="OrganizationName" DataValueField="OrganizationID">
                                                            </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
        SelectCommand="SELECT [OrganizationName], [OrganizationID] FROM [Organization] WHERE (([OrganizationName] LIKE '%' + @OrganizationName2 + '%') ) ORDER BY Sequence,[OrganizationName]">
        <SelectParameters>
            <asp:Parameter DefaultValue="%工務段%" Name="OrganizationName2" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource><cc1:ConfirmButtonExtender id="ConfirmButtonExtender1" runat="server" TargetControlID="InsertButton" ConfirmText="確定要新增?">
    </cc1:ConfirmButtonExtender>
                                                            &nbsp;<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                                                                Text="新增" ValidationGroup="vRole2Insert"></asp:LinkButton>
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlOrganizationName"
                                                                Display="None" ErrorMessage="請選擇單位名稱!!" InitialValue="0" SetFocusOnError="True"
                                                                ValidationGroup="vRole2Insert"></asp:RequiredFieldValidator></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </InsertItemTemplate>
                                    </asp:FormView>
                                    <asp:SqlDataSource id="dsRole2" runat="server" SelectCommand="SELECT a.*,b.OrganizationName FROM [FD_OrganizationRoadMapping] a join Organization b on a.OrganizationID=b.OrganizationID WHERE (([RoadID] = @RoadID) AND ([Manage_Type] = @Manage_Type)) ORDER BY b.Sequence,[RoadID]" UpdateCommand="update [FD_OrganizationRoadMapping] set OrganizationID=@New_OrganizationID WHERE [RoadID] = @RoadID AND [OrganizationID] = @OrganizationID AND [Manage_Type] = @Manage_Type" DeleteCommand="DELETE FROM [FD_OrganizationRoadMapping] WHERE [RoadID] = @RoadID AND [OrganizationID] = @OrganizationID AND [Manage_Type] = @Manage_Type" InsertCommand="INSERT INTO [FD_OrganizationRoadMapping] ([RoadID],[OrganizationID], [Manage_Type]) VALUES (@RoadID,@OrganizationID, @Manage_Type)" ConnectionString="<%$ ConnectionStrings:connStr %>">
                                        <SelectParameters>
                                            <asp:Parameter Name="RoadID" Type="String" />
                                            <asp:Parameter DefaultValue="2" Name="Manage_Type" Type="String" />
                                        </SelectParameters>
                                        <DeleteParameters>
                                            <asp:Parameter Name="RoadID" Type="String" />
                                            <asp:Parameter Name="OrganizationID" Type="Int32" />
                                            <asp:Parameter DefaultValue="2" Name="Manage_Type" Type="String" />
                                        </DeleteParameters>
                                        <UpdateParameters>
                                            <asp:Parameter Name="RoadID" Type="String" />
                                            <asp:Parameter Name="OrganizationID" Type="Int32" />
                                            <asp:Parameter DefaultValue="2" Name="Manage_Type" Type="String" />
                                            <asp:Parameter Name="New_OrganizationID" Type="Int32" />
                                        </UpdateParameters>
                                        <InsertParameters>
                                            <asp:Parameter Name="RoadID" Type="String" />
                                            <asp:Parameter Name="OrganizationID" Type="Int32" />
                                            <asp:Parameter DefaultValue="2" Name="Manage_Type" Type="String" />
                                        </InsertParameters>
                                    </asp:SqlDataSource>
                                    <My:MyGridView id="gvRole2" runat="server" Width="99%" DataSourceID="dsRole2" DataKeyNames="RoadID,OrganizationID,Manage_Type" OnRowDataBound="gvRole2_RowDataBound" ShowFooterWhenEmpty="False" ForeColor="#333333" GridLines="Horizontal" CellPadding="3" BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF" BackColor="White" AutoGenerateColumns="False" MySortDirection="Ascending" AllowHoverEffect="False" AllowHoverSelect="False" SkinID="pager" TotalRowCount="0" OnRowUpdating="gvRole2_RowUpdating">
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#999999" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <EmptyDataRowStyle HorizontalAlign="Center" />
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="NO" InsertVisible="False">
                                                <edititemtemplate>
<asp:Label id="lblNO" runat="server"></asp:Label>
</edititemtemplate>
                                                <itemtemplate>
<asp:Label id="lblNO" runat="server" __designer:wfdid="w69"></asp:Label> 
</itemtemplate>
                                                <headerstyle width="20px" />
                                                <itemstyle horizontalalign="Center" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="單位名稱" SortExpression="OrganizationName">
                                                <edititemtemplate>
<asp:DropDownList id="ddlOrganizationName" runat="server" DataSourceID="SqlDataSource1" __designer:wfdid="w70" DataValueField="OrganizationID" DataTextField="OrganizationName"></asp:DropDownList> <asp:HiddenField id="hideOrganizationID" runat="server" __designer:wfdid="w71" Value='<%# Bind("OrganizationID") %>'></asp:HiddenField><asp:SqlDataSource id="SqlDataSource1" __designer:dtid="281479271678074" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>" SelectCommand="SELECT [OrganizationName], [OrganizationID] FROM [Organization] WHERE (([OrganizationName] LIKE '%' + @OrganizationName2 + '%') ) ORDER BY Sequence,[OrganizationName]" __designer:wfdid="w74">
        <SelectParameters __designer:dtid="281479271678075">
            <asp:Parameter __designer:dtid="281479271678076" DefaultValue="%工務段%" Name="OrganizationName2" Type="String"  />
        </SelectParameters>
    </asp:SqlDataSource> <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ValidationGroup="vRole2Edit" SetFocusOnError="True" InitialValue="0" ErrorMessage="請選擇單位名稱!!" Display="None" ControlToValidate="ddlOrganizationName" __designer:wfdid="w73"></asp:RequiredFieldValidator> 
</edititemtemplate>
                                                <itemtemplate>
<asp:Label id="Label3" runat="server" Text='<%# Bind("OrganizationName") %>'></asp:Label> 
</itemtemplate>
                                                <headerstyle width="120px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField ShowHeader="False">
                                                <edititemtemplate>
<asp:LinkButton id="LinkButton1" runat="server" ValidationGroup="vRole2Edit" Text="更新" CommandName="Update" CausesValidation="True" __designer:wfdid="w75"></asp:LinkButton>&nbsp;<asp:LinkButton id="LinkButton2" runat="server" Text="取消" CommandName="Cancel" CausesValidation="False" __designer:wfdid="w76"></asp:LinkButton> 
</edititemtemplate>
                                                <itemtemplate>
<asp:LinkButton id="LinkButton1" runat="server" Text="編輯" CommandName="Edit" CausesValidation="False"></asp:LinkButton>&nbsp; <asp:LinkButton id="deletebutton" runat="server" Text="刪除" CommandName="Delete" CausesValidation="False"></asp:LinkButton><cc1:ConfirmButtonExtender id="ConfirmButtonExtender3" runat="server" TargetControlID="deletebutton" ConfirmText="確定要刪除?(相關案件將無法再對應!!)"></cc1:ConfirmButtonExtender> 
</itemtemplate>
                                                <headerstyle width="70px" />
                                                <itemstyle horizontalalign="Center" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    </My:MyGridView>
                                    <asp:ValidationSummary ID="ValidationSummary5" runat="server" DisplayMode="List" 
            ShowMessageBox="True" ShowSummary="False" ValidationGroup="vRole2Insert" />
                                    <asp:ValidationSummary ID="ValidationSummary6" runat="server" DisplayMode="List" 
            ShowMessageBox="True" ShowSummary="False" ValidationGroup="vRole2Edit" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
</asp:Panel>
</ContentTemplate>
        </asp:UpdatePanel>
        <br />
        <div align="center">
            <asp:ImageButton ID="btnQuit" ImageUrl="~/images/image/but_09.jpg" OnClientClick="window.close();" runat="server" />
        </div>
    </form>
</body>
</html>